The present invention relates generally to computer programming languages, and more particularly to a system and method for interacting with computer programming languages at a semantic and/or a syntactic level through an object-oriented code model and interface.
Computer programs are written in one or more programming languages and generally have their own syntax. Computer programming languages also have their own set of axiomatic semantic concepts, features and functionality. The axiomatic semantic concepts define a language in terms of discrete entities that are implemented by that language. For example, a language may implement entities such as objects, subroutines, functions, data structures, control structures, decision structures, statements and expressions. Differences in syntax, semantics and functionality introduce complexity into computer programming, however, since programmers must decide which languages to work with, and must learn the syntax, semantic concepts, features and functionality of various languages. Unfortunately, valuable time, energy and resources are expended interacting with various languages.
Computer programming has become more tool-based. Thus, tools like wizards, modeling tools, code analyzers and code generators, for example, have become more common. But creating such tools is hampered by the necessity of the tool maker having to create a parser for each language with which the tool interacts.
Differences in accessing object attributes and invoking object methods may also add complexity to computer programming. For example, some languages pass parameters by reference while others pass parameters by value and yet others may use a combination. Thus, interacting with different languages may require adherence to different parameter passing protocols. Consequently, there is a need for an interface model to simplify programming and interactions with various languages.
The present invention relates to a system and method for modeling programming language concepts via a plurality of code model objects. The present invention enables a computer programmer to interact with a plurality of programming languages through a code model interface wherein syntactically and functionally unique programming languages are modeled by objects that encapsulate the semantics and functionality of the language. Thus, the present invention provides a set of objects and an interface to the set of objects associated with a code model of one or more programming languages. The code model returns to the programmer objects that encapsulate the high level or semantic programming elements of the computer programming language while insulating the programmer from the syntax of the high-level, semantic programming elements. Although the programmer is insulated from the syntax of the code behind the object, the programmer has the ability to access code behind the object and to change the code.
The code model enables computer programmers to learn the interface to the code model objects, and then employ the functionality embedded in other computer programming languages that implement the code model. The code model programmer thus gains access to many languages, objects and functionalities while only learning one syntax.
More particularly, the present invention utilizes a set of code model objects to provide a map to an abstraction of programming languages as modeled by their semantic elements. An example set of semantic elements available to be modeled by the code model objects may be listed in a collection and/or enumeration in accordance with one aspect of the present invention. A semantic element listed in the collection and/or enumeration may model high-level abstractions of semantic concepts embodied in programming languages like a class, an object, a function, a method, an attribute, a variable, a delegate, a statement and a parameter, for example. Thus programmers may view the semantic elements of a language and utilize the semantic elements in a language without learning the syntax of that language. For example objects, functions, methods, attributes, variables, delegates and parameters of programming languages may be employed without learning the syntax specific to the language from which those semantic elements were drawn.
Different programming tools, for example Class View, wizards, UML modeling tools, may desire to interact with programming projects. The code model facilitates understanding the contents of the project and thus facilitates interacting with (e.g. modifying, adding, deleting) the project in a language neutral way. For example, Class View may retrieve a list of classes found in a project and a wizard may add a database class to the project without knowing the syntax or semantics of the project language.
Furthermore, the code model mitigates the problem of tool builders having to build parsers for each language with which they desire to interact. The code model allows the tool builder to build one parser to the code model thus mitigating the multiple parser problem.
The code model also enables the programmer to change implementations of programming elements behind the code model object by adding, subtracting and/or modifying items like attributes and/or by invoking methods from that code model object. The computer programmer can change the implementations either by interacting with the code model object methods or by directly accessing a text editor to manually change the programming element behind the code model object.
To the accomplishment of the foregoing and related ends, certain illustrative aspects of the invention are described herein in connection with the following description and the annexed drawings. These aspects are indicative, however, of but a few of the various ways in which the principles of the invention may be employed and the present invention is intended to include all such aspects and their equivalents. Other advantages and novel features of the invention will become apparent from the following detailed description of the invention when considered in conjunction with the drawings.